//
//  MyLocationMapController.m
//  FD
//
//  Created by xiaofang wang on 2018/10/30.
//  Copyright © 2018年 ZhiYuan Network. All rights reserved.
//  定位地图viewController
//上面是地图 下面是地址列表
/**
 1.自定义导航条
 2.上面地图
 3.下面地址列表。
*/
///做不出来


#import "MyLocationMapController.h"
#import "MyLocalMapView.h"
#import "MyLocalAddressListView.h"
#import "RBSearchNavBarView.h"

@interface MyLocationMapController ()
/**地图view*/
@property (nonatomic, strong) MyLocalMapView *localMapView;
/**地址列表*/
@property (nonatomic, strong) MyLocalAddressListView *addressListView;
@end

@implementation MyLocationMapController
- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupView];
}

- (void)setupView {
    
    //搜索框导航条
    [self setupSearchNavView];
    
    //上面是地图
    self.localMapView = [[MyLocalMapView alloc] initWithFrame:CGRectMake(0, FD_NavH, SCREEN_WIDTH, 300)];
    [self.view addSubview:self.localMapView];
    
    //下面是地址列表
    CGRect addressListVFrame = CGRectMake(0, self.localMapView.rb_bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.localMapView.rb_bottom);
    self.addressListView = [[MyLocalAddressListView alloc] initWithFrame:addressListVFrame];
    [self.view addSubview:self.addressListView];
}

- (void)setupSearchNavView {
    //带输入框的导航条
    RBSearchNavBarView *searchNavView = [[RBSearchNavBarView alloc] initWithFrame:CGRectMake(0, 0, 300, 40)];
    self.navigationItem.titleView  = searchNavView;
    
    
    //搜索回调
    searchNavView.searchBlock = ^(NSString *searchStr) {
        FDLog(@"搜索内容是:%@",searchStr);
    };
    //取消回调
    searchNavView.searchNavBarViewClickCancelButtonBlock = ^{
        FDLog(@"取消搜索");
        
        //回收键盘
        [self.view endEditing:YES];
    };
}

@end
